<!-- 网络请求 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 解决闪烁问题 */
        [v-clock] {
            display: none;
        }
    </style>
</head>
<body>
    <!-- view 层 模板 -->
    <div id="vue" v-clock>
        <div>{{info.name}}</div>
        <div>{{info.address}}</div>
        <div>{{info.links[0].url}}</div>
        <a v-bind:href="info.url">百度</a>
    </div>

    <!-- 导入vue.js -->
    <script src="../public/vue2-5-21.js"></script>
    <script src="../public/axios.min.js"></script>
    <script>

        var vm = new Vue({
            // 绑定dom
            el: "#vue",

            // 这个data方法用于接收请求数据
            data(){
                return {
                    // 必须和json字符串一样
                    info: {
                        name: null,
                        address: {
                            city: null,
                            country: null
                        },
                        links: [],
                        url: null
                    }
                }
            },
            mounted(){ // 钩子函数
                axios.get('http://127.0.0.1:5000/get_vue_json').then(response => (this.info=response.data))
            }
        });

    </script>
</body>
</html>